home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / SHARED.DIR / 03077_Script_GO HANDLERS LEONARDO I & II < prev    next >
Text File  |  1996-04-01  |  14KB  |  532 lines

  1. -- -----------------------------------------------------------
  2. -- Handler goInventions goes to the inventions screen if the
  3. -- inventions animation has already been viewed and to the
  4. -- inventions animation otherwise.
  5.  
  6. on goInventions
  7.   global inventionsAnimationViewed
  8.   
  9.   --  waitCursor
  10.   --  stopVoice
  11.   playLoadingSound
  12.   
  13.   if voidP(inventionsAnimationViewed) then
  14.     set inventionsFrame = "mark1"
  15.     set inventionsAnimationViewed = TRUE
  16.   else
  17.     set inventionsFrame = "mark2"
  18.   end if
  19.   
  20.   stopVoice
  21.   go frame inventionsFrame of movie the pathName & "InveAnim.dir"
  22.   
  23.   normalCursor
  24. end
  25.  
  26. -- -----------------------------------------------------------
  27. -- Handler goInvention goes to the movie of the given invention.
  28.  
  29. on goInvention which
  30.   global currentInvention
  31.   
  32.   waitCursor
  33.   stopVoice
  34.   playLoadingSound
  35.   
  36.   set currentInvention = which
  37.   put getInventionMovieName (which) into InventionMovieName
  38.   
  39.   if (InventionMovieName = empty) then
  40.     go frame which of movie the pathName & "Leonardo"
  41.   else
  42.     go movie the pathName & InventionMovieName
  43.   end if
  44.   normalCursor
  45. end
  46.  
  47. -- -----------------------------------------------------------
  48. -- Handler goIntroduction goes to the introduction movie.
  49.  
  50. on goIntroduction
  51.   waitCursor
  52.   playLoadingSound
  53.   go frame "BeginIntro" of movie the pathName & "Intro"
  54.   normalCursor
  55. end
  56.  
  57. -- -----------------------------------------------------------
  58. -- Handler goBiography goes to the biography movie.
  59.  
  60. on goBiography
  61.   waitCursor
  62.   playLoadingSound
  63.   go movie the pathName & "BIO"
  64.   normalCursor
  65. end
  66.  
  67. -- -----------------------------------------------------------
  68. -- Handler goTimeline goes to the timeline.
  69.  
  70. on goTimeLine
  71.   waitCursor
  72.   playLoadingSound
  73.   go movie the pathName&"Timeline"
  74.   normalCursor
  75. end
  76.  
  77. -- -----------------------------------------------------------
  78. -- Handler doTimeline goes to the index.
  79.  
  80. on doTimeline
  81.   put "*** called doTimeLine from frame" && the frame && "of movie" && the movie
  82.   goIndex -- For historical reasons, this handler has this name.
  83.   -- To eliminate it, must change doTimeLine in every movie to goIndex
  84. end
  85.  
  86. -- -----------------------------------------------------------
  87. -- Handler goWorks goes to the works movie.
  88.  
  89. on goWorks
  90.   waitCursor
  91.   playLoadingSound
  92.   go movie the pathName & "Works"
  93.   normalCursor
  94. end
  95.  
  96. -- -----------------------------------------------------------
  97. -- Handler goBibliography goes to the bibliography.
  98.  
  99. on goBibliography
  100.   waitCursor
  101.   playLoadingSound
  102.   go movie the pathName & "Biblio"
  103.   normalCursor
  104. end
  105.  
  106. -- -----------------------------------------------------------
  107. -- Handler goMonalisa goes to the MomaLiza old movie
  108.  
  109. on goMonalisa
  110.   waitCursor
  111.   playLoadingSound
  112.   go movie the pathName & "MonaLisa"
  113.   normalCursor
  114. end
  115.  
  116.  
  117. -- -----------------------------------------------------------
  118. -- Handler doQuit goes to the credits movie.
  119.  
  120. on doQuit
  121.   playLoadingSound
  122.   go movie the pathName&"Credits"
  123. end
  124.  
  125. -- -----------------------------------------------------------
  126. -- Handler goMain goes to the main movie (frame "contents" of
  127. -- movie "Leonardo.dir")
  128.  
  129. on goMain
  130.   waitCursor
  131.   stopVoice
  132.   playLoadingSound
  133.   
  134.   if (the movie = "Leonardo.DIR") then
  135.     unhiliteButton
  136.     go frame "Contents"
  137.   else
  138.     go frame "Contents" of movie the pathName & "Leonardo.DIR"
  139.   end if
  140.   
  141.   normalCursor
  142. end
  143.  
  144. -- -----------------------------------------------------------
  145. -- Handler goTour goes to 
  146. -- movie "Tour.dir")
  147.  
  148. on goTour
  149.   waitCursor
  150.   --stopVoice
  151.   --sound stop 1
  152.   
  153.   go  movie the pathName & "tour.DIR"
  154.   
  155.   normalCursor
  156. end
  157.  
  158. -- -----------------------------------------------------------
  159. -- Handler rememberLocation 
  160.  
  161. on rememberLocation
  162.   global indexReturn, currentInvention
  163.   
  164.   set indexReturn = ""
  165.   
  166.   if (char 1 to 2  of the movie = "I_") then
  167.     set  indexReturn = "frame" && quote & currentInvention && "menu" & quote && "of movie" && quote & getInventionMovieName (currentInvention) & quote
  168.   else if (the movie = "Leonardo.DIR") then
  169.     repeat with i = 0 to 1
  170.     end repeat
  171.   else if (char 1 to 3  of the movie = "ML_") then
  172.     set indexReturn = "frame" && quote & getCategoryFromMonaLisaMovieName (the movie) && "menu noSound" & quote && "of movie" && quote & the movie & quote
  173.   else
  174.     set indexReturn = "movie" && quote & the movie & quote
  175.   end if
  176. end
  177.  
  178. -- -----------------------------------------------------------
  179. -- Handler goIndex stores the current location and goes to the
  180. -- index movie.
  181.  
  182. on goIndex
  183.   rememberLocation
  184.   playLoadingSound
  185.   go movie the pathName & "INDEX"
  186. end
  187.  
  188. -- -----------------------------------------------------------
  189. -- Handler goDatabase goes to the database movie.
  190.  
  191. on goDatabase
  192.   playLoadingSound
  193.   go movie the pathName & "database.dir"
  194. end
  195.  
  196. -- -----------------------------------------------------------
  197. -- Handler goHelp goes to the help movie.
  198.  
  199. on goHelp
  200.   global fromHelpMovie, fromHelpFrame
  201.   playLoadingSound
  202.   set fromHelpMovie = the movieName
  203.   set fromHelpFrame = the frame
  204.   go movie the pathName & "HELP"
  205. end
  206.  
  207. -- -----------------------------------------------------------
  208. -- Handler returnFromHelp returns to the location before the
  209. -- help movie was opened.
  210.  
  211. on returnFromHelp
  212.   global fromHelpMovie, fromHelpFrame
  213.   playLoadingSound
  214.   if fromHelpMovie = "database.dir" then
  215.     set fromHelpFrame = 1
  216.   end if
  217.   
  218.   go frame fromHelpFrame of movie fromHelpMovie
  219. end
  220.  
  221. -- -----------------------------------------------------------
  222. -- Handler goInventionsWithSound ???
  223. --
  224. --on goInventionsWithSound
  225. --  global alreadyViewedInventionsWSound
  226. --  
  227. --  waitCursor
  228. --  
  229. --  if (alreadyViewedInventionsWSound = empty) then
  230. --    set alreadyViewedInventionsWSound = false
  231. --  end if
  232. --  
  233. --  if alreadyViewedInventionsWSound then
  234. --    goInventions
  235. --    exit
  236. --  end if
  237. --  
  238. --  set alreadyViewedInventionsWSound = true
  239. --  
  240. --  if (the movie = "Leonardo.DIR") then
  241. --    go frame "Inventions Menu"
  242. --  else
  243. --    go frame "Inventions Menu" of movie the pathName&"Leonardo.DIR"
  244. --  end if
  245. --  normalCursor
  246. --end
  247. --
  248. -- -----------------------------------------------------------
  249. -- Handler goInventions ???
  250. --
  251. --on goInventions
  252. --  waitCursor
  253. --  stopVoice
  254. --  playLoadingSound
  255. --  
  256. --  if (the movie = "Leonardo.DIR") then
  257. --    go frame "Inventions Menu noSound"
  258. --  else
  259. --    go frame "Inventions Menu noSound" of movie the pathName & "Leonardo.DIR"
  260. --  end if
  261. --  
  262. --  normalCursor
  263. --end
  264. --
  265. -- -----------------------------------------------------------
  266. -- Handler goBack goes to the main.
  267.  
  268. on goBack
  269.   -- Go up in heirarchy...
  270.   -- For now, just goes to contents, because other "Menu" sprites
  271.   -- have their own command.
  272.   goMain
  273. end
  274.  
  275. -- -----------------------------------------------------------
  276. -- Handler goWordsToMenu goes from the words section of an
  277. -- invention to the invention's menu (located at the previous
  278. -- marker.)
  279.  
  280. on goWordsToMenu
  281.   unhiliteButton
  282.   go marker (-1)
  283.   unfreezeDigitalVideo
  284. end
  285.  
  286. -- -----------------------------------------------------------
  287. -- Handler goTimeToMenu goes from the time section of an
  288. -- invention to the invention's menu (located at 2 markers
  289. -- earlier.)
  290.  
  291. on goTimeToMenu
  292.   unhiliteButton
  293.   go marker (-2)
  294.   unfreezeDigitalVideo
  295. end
  296.  
  297. -- -----------------------------------------------------------
  298. -- Handler goGameToMenu goes from the time section of an
  299. -- invention to the invention's menu (located at 3 markers
  300. -- earlier.)
  301.  
  302. on goGameToMenu
  303.   unhiliteButton
  304.   go marker (-3)
  305.   unfreezeDigitalVideo
  306. end
  307.  
  308. -- -----------------------------------------------------------
  309. -- Handler goMenu goes to the menu of the invention stored in
  310. -- the global variable currentInvention.
  311.  
  312. on goMenu
  313.   global currentInvention
  314.   
  315.   if not(stringp(currentInvention)) then set currentInvention = ""
  316.   
  317.   unhiliteButton
  318.   set inventionMovie = getInventionMovieName (currentInvention)
  319.   if (the movie = inventionMovie) then
  320.     go frame currentInvention && "menu"
  321.   else
  322.     go frame currentInvention && "menu" of movie inventionMovie
  323.   end if
  324. end
  325.  
  326. -- -----------------------------------------------------------
  327. -- Handler goWords goes from the invention's menu to the word
  328. -- section of the invention (1 marker later)
  329.  
  330. on goWords
  331.   freezeDigitalVideo
  332.   unhiliteButton
  333.   transitionToWords
  334.   go marker (1)
  335. end
  336.  
  337. -- -----------------------------------------------------------
  338. -- Handler goTime goes from the invention's menu to the time
  339. -- section of the invention (2 markers later)
  340.  
  341. on goTime
  342.   global MPEGVersion, currentInvention
  343.   
  344.   if MPEGVersion and existsMPEGForInvention(currentInvention) then
  345.     goMPegTime
  346.   else
  347.     freezeDigitalVideo
  348.     unhiliteButton
  349.     transitionToTime
  350.     sound stop 2
  351.     go marker (2)
  352.   end if
  353. end
  354.  
  355. -- -----------------------------------------------------------
  356. -- Handler goGame goes from the invention's menu to the game
  357. -- section of the invention (3 markers later)
  358.  
  359. on goGame
  360.   freezeDigitalVideo
  361.   unhiliteButton
  362.   transitionToGame
  363.   go marker (3)
  364. end
  365.  
  366. -- -----------------------------------------------------------
  367. -- Handler goCategory goes to the menu of the given category
  368. -- if the option key was pressed and to the beginning of the
  369. -- category otherwise.
  370.  
  371. on goCategory which
  372.   hiliteButtonKeepHilited(1,1)
  373.   set skipIntro = the optionDown
  374.   waitCursor
  375.   playSpecificLoadingSound
  376.   
  377.   if skipIntro then
  378.     goCategoryMenu which
  379.   else
  380.     goCategoryIntro which
  381.   end if
  382.   
  383.   normalCursor
  384. end
  385.  
  386. -- -----------------------------------------------------------
  387. -- Handler goCategoryIntro goes to the next animation of the
  388. -- given category (called by goCategory).
  389.  
  390. on goCategoryIntro which
  391.   waitCursor
  392.   set animationNumber = getAnimationNumber(which)
  393.   set animationFrame = which & animationNumber
  394.   go frame animationFrame of movie (the pathName & "ML_" & char 1 to 5 of which)
  395.   normalCursor
  396. end
  397.  
  398. -- -----------------------------------------------------------
  399. -- Handler getAnimationNumber returns the number of the next
  400. -- animation for the given category.
  401.  
  402. on getAnimationNumber category
  403.   set categoryAnimationData = field "categoryAnimationData"
  404.   set theLine = BinSearchFirstItemInLine(categoryAnimationData, category, ",")
  405.   
  406.   if (theLine = 0) then
  407.     alert category && "not found in categoryAnimationData"
  408.     exit
  409.   end if
  410.   
  411.   set lineData = line theLine of categoryAnimationData
  412.   
  413.   set numAnimations = value(item 2 of lineData)
  414.   set lastAnimation = value(item 3 of lineData)
  415.   
  416.   set currentAnimation = lastAnimation + 1
  417.   
  418.   if (currentAnimation > numAnimations) then
  419.     set currentAnimation = 1
  420.   end if
  421.   
  422.   put currentAnimation into item 3 of line theLine of field "categoryAnimationData"
  423.   return currentAnimation
  424. end
  425.  
  426. -- -----------------------------------------------------------
  427. -- Handler getCategoryNarrationFlag returns 1 if the user already
  428. -- heard the narration for the intro of the given category and 0
  429. -- otherwise.
  430.  
  431. on getCategoryNarrationFlag category
  432.   set categoryAnimationData = field "categoryAnimationData"
  433.   set theLine = BinSearchFirstItemInLine(categoryAnimationData, category, ",")
  434.   
  435.   if (theLine = 0) then
  436.     alert category && "not found in categoryAnimationData"
  437.     exit
  438.   end if
  439.   
  440.   set lineData = line theLine of categoryAnimationData
  441.   set narrationFlag = value(item 4 of lineData)
  442.   
  443.   if (narrationFlag = 0) then
  444.     put string(1) into item 4 of line theLine of field "categoryAnimationData"
  445.   end if
  446.   
  447.   return narrationFlag
  448. end
  449.  
  450. -- -----------------------------------------------------------
  451. -- Handler resetCategoryNarrationFlags is called from initializeLeonardo2.
  452. -- It resets the flags of the category narrations to 0 (meaning they
  453. -- have not been heard yet).
  454.  
  455. on resetCategoryNarrationFlags
  456.   set numCategories = the number of lines in field "categoryAnimationData"
  457.   
  458.   repeat with i = 1 to numCategories
  459.     put string(0) into item 4 of line i of field "categoryAnimationData"
  460.   end repeat
  461. end
  462.  
  463. -- -----------------------------------------------------------
  464. -- Handler goCategoryMenu goes to the menu of the given category
  465. -- (called by goCategory).
  466.  
  467. on goCategoryMenu which
  468.   waitCursor
  469.   
  470.   set narrationFlag = getCategoryNarrationFlag(which)
  471.   
  472.   if narrationFlag then
  473.     set menuFrame = which && "menu noSound"
  474.   else
  475.     set menuFrame = which && "menu"
  476.   end if
  477.   
  478.   if (the movie = ("ML_" & (char 1 to 5 of which) & ".DIR")) then
  479.     -- already in the right movie, just go to the right frame
  480.     --    unhiliteButton
  481.     dissolve 3 
  482.     go frame menuFrame
  483.   else
  484.     -- go to the right frame of the right movie
  485.     go frame menuFrame of movie (the pathName & "ML_" & (char 1 to 5 of which) &".DIR")
  486.   end if 
  487.   normalCursor
  488. end
  489.  
  490. -- -----------------------------------------------------------
  491. -- Handler returnToCategoryMenu goes to the menu of the given
  492. -- category
  493.  
  494. on returnToCategoryMenu which
  495.   waitCursor
  496.   stopVoice
  497.   playLoadingSound
  498.   go frame which && "menu noSound" of movie (the pathName&"ML_" & char 1 to 5 of which)
  499.   normalCursor
  500. end
  501.  
  502. -- ----------------------------------------------------------------
  503. -- Handler goMoreInvention 
  504.  
  505. on goMoreInvention inventionMarker
  506.   go frame inventionMarker
  507. end
  508.  
  509. -- ----------------------------------------------------------------
  510. -- Handler returnMoreInventionsMenu 
  511.  
  512. on returnMoreInventionsMenu
  513.   go frame "MInventStart"
  514. end
  515.  
  516. -- ----------------------------------------------------------------
  517. -- Handler replay 
  518.  
  519. on replay replayMarker, replayMovie
  520.   
  521.   clearDigitalVideo
  522.   
  523.   if voidP(replayMovie) or (the movieName = replayMovie) then
  524.     go frame replayMarker
  525.   else
  526.     go frame replayMarker of movie replayMovie
  527.   end if
  528. end mouseDown
  529.  
  530. on existsMPEGForInvention whichInvention
  531.   return getPos(["BridgeCanal", "diving", "dredger", "helicopter", "landinggear", "paddleboat", "Snorkel", "tank", "walls", "Wing", "Woodwind"] whichInvention)
  532. end